let props={
    name:'zh',
    age:30
}
interface Propxy<T>{
    get():T
    set(newValue:T):void
}
type Propxify<T>={
    [K in keyof T]:Propxy<T[K]>
}
//装包
function proxy<T>(props:T):Propxify<T>{
    const rerult={} as Propxify<T>;
    for(let key in props){
        let oldValue=props[key];
        rerult[key]={
            get(){
                return oldValue
            },
            set(newvalue){
                oldValue=newvalue
            }
        }
    }
    return rerult

}
//拆包
let proxyProps=proxy(props)
const dd=proxyProps.name.get()
const dd1=proxyProps.age.set(88)
const d3=proxyProps.age.get()

function unProxy<T>(props:Propxify<T>):T{
    const result={} as T
    for(let key in props){
        result[key]=props[key].get()
    }
    return result

}
let unProxyProps=unProxy(proxyProps);


export {}